# -*- coding: utf-8 -*-
#
# Author:: Jonny
# Date:: 2022/4/24


# 刷到对话框边界 (772,28,1256,695)
# 老君查岗弹窗-验证码 (208,119,1071,649)
import os
import uuid

from compat.project_paths import project_path

from lib.image_ import img_cut
from submodules.common.lib import path_

obj_path = os.path.join(project_path, "obj")


def obj_cut(obj_info):
    element_name = obj_info["name"]
    bounds_tuple = obj_info["bounds"]
    tmp_list = element_name.split("_")
    page_name = tmp_list[0]
    page_filename = tmp_list[1]
    image_path_in = os.path.join(obj_path, page_name, f"{page_filename}.png")
    # image_path_out = os.path.join(os.getcwd(), element_name + ".png")
    image_path_out = os.path.join(obj_path, page_name, element_name + ".png")
    res = img_cut(
        image_path_in=image_path_in,
        image_path_out=image_path_out,
        bounds_tuple=bounds_tuple,
    )


if __name__ == "__main__":
    from obj import obj_info

    obj_info = obj_info.登录页面_登录弹窗4_账号文本框_下拉菜单第一项_删除图标
    obj_cut(obj_info)
